import { request } from '@/axios/request'
// export function getDetail(id: string) {
//   return request.get('/api/users')
// }
export function getList(config: { currentPage: number; pageSize?: number; searchValue?: string }) {
  return request.get('/v1/list', { params: config })
}
// 

//查询用户收藏的病友圈
export function findUserSickCollectionList(
  userId: number,
  sessionId: string,
  config: { page: number; count: number }
) {
  return request({
    url: '/api/health/user/verify/v1/findUserSickCollectionList',
    method: 'GET',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    params: config
  })
}
//用户取消视频收藏
export function cancelVideoCollection(
  userId: number,
  sessionId: string,
  config: { videoId: number }
) {
  return request({
    url: '/api/health/user/verify/v1/cancelVideoCollection',
    method: 'DELETE',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    params: config
  })
}
//查询用户收藏视频
export function findVideoCollectionList(
  userId: number,
  sessionId: string,
  config: { page: number; count: number }
) {
  return request({
    url: '/api/health/user/verify/v1/findVideoCollectionList',
    method: 'GET',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    params: config
  })
}

// 查询用户资讯收藏列表
export function getUserInfoCollectionList(
  userId: number,
  sessionId: string,
  config: { page: number; count: number }
) {
  return request({
    url: '/api/health/user/verify/v1/findUserInfoCollectionList',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    method: 'GET',
    params: config
  })
}

// 定义查询用户问诊通知列表
export function getInquiryNoticeList(
  userId: number,
  sessionId: string,
  config: { page: number; count: number }
) {
  return request({
    url: '/api/health/user/verify/v1/findInquiryNoticeList',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    method: 'GET',
    params: config
  })
}

// 定义查询用户H币通知列表
export function getHealthyCurrencyNoticeList(
  userId: number,
  sessionId: string,
  config: { page: number; count: number }
) {
  return request({
    url: '/api/health/user/verify/v1/findHealthyCurrencyNoticeList',
    headers: {
      userId: userId,
      sessionId: sessionId
    },
    method: 'GET',
    params: config
  })
}

// 根据资讯板块查询资讯列表
// export const getFindInfor = async (data: any, headers: any) => {
//   // 将 data 对象转换为查询字符串
//   const params = new URLSearchParams(data).toString() // 将 data 转换为查询字符串
//   // 发送 GET 请求
//   return await request.get(`/api/health/share/information/v1/findInformationList?${params}`, {
//     headers: headers // 保持 headers 不变
//   })
// }

// 医生接口
export function getDoctor(config: {
  deptId: number
  condition: number
  sortBy: number
  page: number
  count: number
}) {
  return request.get('/api/health/user/inquiry/v1/findDoctorList', { params: config })
}
// 我的钱包
export function getUserWallet(config: { userId: number; sessionId: string }) {
  return request.get('/api/health/user/verify/v1/findUserWallet', {
    params: config
  })
}
// 消费记录
export function getRecord(confing: {
  userId: number
  sessionId: string
  page: number
  count: number
}) {
  return request.get('/api/health/user/verify/v1/findUserConsumptionRecordList', {
    params: confing
  })
}
// 消费记录
export const getfindUserConsumptionRecordList = async (config: {
  userId: number
  sessionId: string
  page: number
  count: number
}) => {
  return await request.get('/health/user/verify/v1/findUserConsumptionRecordList', {
    params: config
  })
}

export function getHomeTab() {
  return request.get('/api/health/share/information/v1/findInformationPlateList')
}
export function getDocter(config: {
  deptId: number
  condition: number
  sortBy: number
  page: number
  count: number
}) {
  return request.get('/api/health/user/inquiry/v1/findDoctorList', {
    params: config
  })
}

// 病友圈列表数据
export function PatientList(data: { departmentId?: number; page?: number; count?: number }) {
  return request.get('/api/health/user/sickCircle/v1/findSickCircleList', { params: data })
}
// 查询科室列表
export const getgord = async () => {
  return await request.get('/api/health/share/knowledgeBase/v1/findDepartment')
}
// 根据科室查询对应病症
export function getgordDetail(config: { departmentId?: number }) {
  return request.get('/api/health/share/knowledgeBase/v1/findDiseaseCategory', { params: config })
}
// 查询常见病症详情
export function getgordDetailData(config: { id: number }) {
  return request.get('/api/health/share/knowledgeBase/v1/findDiseaseKnowledge', { params: config })
}
// 药品科目分类列表查询
export function getMedicine() {
  return request.get('/api/health/share/knowledgeBase/v1/findDrugsCategoryList')
}
// 根据药品类目查询常见药品
export function getMedicineDetail(config: {
  drugsCategoryId?: number
  page?: number
  count?: number
}) {
  return request.get('/api/health/share/knowledgeBase/v1/findDrugsKnowledgeList', {
    params: config
  })
}
// 查询常见药品详情
export function getMedicineDetailData(config: { id: number }) {
  return request.get('/api//health/share/knowledgeBase/v1/findDrugsKnowledge', { params: config })
}
// 查询病友圈详情
export function getSickCircleInfo(data: any) {
  return request.get('/api/health/user/sickCircle/v1/findSickCircleInfo', { params: data })
}
// 根据资讯板块查询资讯列表
export function getFindInfor(config: { plateId?: number; page?: number; count?: number }) {
  return request.get('/api/health/share/information/v1/findInformationList', { params: config })
}
// 资讯详情
export function getFindInforDetail(config: { infoId: number }) {
  return request.get('/api/health/share/information/v1/findInformation', { params: config })
}
// 病友圈发表评论
// export function getpublishCommentList(data:{sickCircleId?:number;content?:number;}){
//     return request.get('/api/health/user/sickCircle/verify/v1/publishComment',{params:data})
// }
// 病友圈评论列表
export const getSickCircleCommentList = (data: any, headers: any) => {
  return request.get('/api/health/user/sickCircle/v1/findSickCircleCommentList', {
    params: data,
    headers
  })
}
// 发表评论
export const getpublishCommentList = async (data: any, headers: any) => {
  return await request.post('/api/health/user/sickCircle/verify/v1/publishComment', data, headers)
}

// export const getPatientSickCircleList = async()=>{
//   return await
// }
// 查看病友的病友圈发帖列表
export const getPatientSickCircleList = (data: any) => {
  return request.get('/api/health/user/sickCircle/v1/findPatientSickCircleList', { params: data })
}
// 收藏资讯
export function getCollect(userId: number, sessionId: string, data: number) {
  return request({
    url: '/api/health/user/verify/v1/addInfoCollection',
    headers: {
      userId: userId,
      sessionId: sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'POST',
    data: data
  })
}
// 查询用户资讯收藏列表
export function getCollectDetail(userId: number, sessionId: string, data: number) {
  return request({
    url: '/api/health/user/verify/v1/findUserInfoCollectionList',
    headers: {
      userId: userId,
      sessionId: sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'GET',
    data:data
  })
}
// 取消资讯收藏
export function getCollectDetailCancel(userId: number, sessionId: string,infoId:number){
  return request({
    url:'/api/health/user/verify/v1/cancelInfoCollection',
    headers:{
      userId: userId,
      sessionId: sessionId,
    },
    method:"DELETE",
   params:{infoId}
  })
}
export const getpublishSickCircle = async (data:any,headers:any) => {
    return await request.post("/api/health/user/sickCircle/verify/v1/publishSickCircle", data,headers)
}
// 根据科室查询对应病症
export const getDiseaseCategory = async (data:any) => {
    return await request.get("/api/health/share/knowledgeBase/v1/findDiseaseCategory", { params: data })
}
// 收藏病友圈
export const getaddUserSickCollection = async(data: any, headers: any)=>{
  return await request.post('/api/health/user/verify/v1/addUserSickCollection',data, headers)
}
// /health/user/inquiry/v1/findDoctorEvaluateList
// 查询医生评价列表
export const DoctorEvaluateList = async(data:any)=>{
  return await request.get('/api/health/user/inquiry/v1/findDoctorEvaluateList',{ params: data })
} 
// 取消收藏病友圈
export const getcancelSickCollection = async(data: any, headers: any)=>{
  return await request.delete('/api/health/user/verify/v1/cancelSickCollection',{params: data,headers})
}
// 生成邀请码
export function getInvite(userId: number, sessionId: string){
  return request({
    url:'/api/health/user/verify/v1/makeInvitationCode',
    headers:{
      userId: userId,
      sessionId: sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method:"POST",
  })
}
// 查询用户邀请码
export function getInvitecheck(userId:number,sessionId:string){
  return request({
    url:'/api/health/user/verify/v1/findUserInvitationCode',
    headers:{
      userId: userId,
      sessionId: sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method:'GET'
  })
}
// 查询用户关注医生列表
export function getInterest(userId:number,sessionId:number,config:object){
  return request({
    url:'/api/health/user/verify/v1/findUserDoctorFollowList',
    headers:{
      userId:userId,
      sessionId:sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method:"GET",
    params:config
  })
}
// 取消关注医生
export function getcancel(userId:number,sessionId:string,doctorId:number){
  return request({
    url:"/api/health/user/inquiry/verify/v1/cancelFollow",
    headers:{
      userId:userId,
      sessionId:sessionId,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method:"DELETE",
    params:{doctorId}
  })
}
// 患者-发送消息（文本消息）
export function getsending(userId:number,sessionId:string,config:object){
  return request({
    url:"/api/health/user/inquiry/verify/v1/pushMessage",
    headers:{
      userId:userId,
      sessionId:sessionId,
    },
    method:'POST',
    params:config
  })
}
// 查询历史问诊聊天记录
export function getchatRecord(userId:number,sessionId:string,configs:object){
  return request({
    url:"/api/health/user/inquiry/verify/v1/findInquiryRecordList",
    headers:{
      userId:userId,
      sessionId:sessionId,
    },
    method:'GET',
    params:configs
  })
}